package com.liu.audio.domain;

import lombok.Data;

import java.util.Arrays;
import java.util.Base64;

@Data
public class CosyVoice {
    private int id;
    private String text;
    private String audio;

    public CosyVoice(int id, String text, byte[] audio) {
        this.id = id;
        this.text = text;
        if (audio != null) {
            // 截取有效部分
            byte[] validData = Arrays.copyOf(audio, audio.length);
            this.audio = Base64.getEncoder().encodeToString(validData);
        }
    }

}
